Ext.onReady(function(){
    Ext.define('json_data',{
        extend: 'Ext.data.Model',
        fields: [
             {name:'username',type:'string'},
             {name:'email',type:'string'},
             {name:'is_active',type:'boolean'},
             {name:'is_superuser',type:'boolean'},
             {name:'is_staff',type:'boolean'},
             {name:'date_joined',type:'date',format:'Y年m月d日'}
        ]
    });
    //创建数据源
    var store = Ext.create('Ext.data.Store', {
    	pageSize:20,
        model: 'json_data',
	    proxy: {
	        type: 'ajax',
	        url: '/usercontrol/queryUserBy/',
	        actionMethods:'post',
	        reader: {
	            type: 'json',
	            root: 'rows',
	            totalProperty: 'totalCount'
	        }
	    },
	    autoLoad: true
    });
    
    var grid = Ext.create('Ext.grid.Panel', {
        store: store,
        //height: 500,
        title: '复杂表头',
        renderTo: 'salary-grid',
        //frame:true,
        columnLines: true,
        loadMask:true,
        viewConfig: {
            stripeRows: true
        },
        dockedItems : [{
            xtype : 'pagingtoolbar',
            store : store,
            dock : 'bottom',
            displayInfo : true,
            autoScroll:true 
        }],       
        columns: [{
            text     : 'username',
            width    : 750,
            flex     : 1,
            sortable : false,
            dataIndex: 'username'
        }, {
            text: '综合',
            columns: [{
                text     : 'is_active',
                width    : 75,
                sortable : true,
                dataIndex: 'is_active'
            }, {
                text     : 'is_superuser',
                width    : 75,
                sortable : true,
                dataIndex: 'is_superuser'
            }, {
                text     : 'is_staff',
                width    : 75,
                sortable : true,
                dataIndex: 'is_staff'
            }]
        }, {
            text     : 'email',
            width    : 85,
            sortable : true,
            dataIndex: 'email'
        }]
    });    
});